//
//  LZXAppDelegate.m
//  LocalRecorderDemo
//
//  Created by x on 13-7-25.
//  Copyright (c) 2013年 . All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>

@protocol LocalRecorderDelegate <NSObject>

-(void)recordRunning;
-(void)recordCompleted;
#if defined(LOCAL_SOURCE2)
- (void)recordCompleted2;
#endif

@end

@interface LocalRecorder : NSObject
{
    //id ParentID;
    UIView *targetView;
    NSMutableArray *imageArr;
    NSMutableArray *imagePixelBufferArr;
    BOOL isVideo;
    CFAbsoluteTime startTime;
    
    //for speeding up the process
    NSDictionary *options;
    
    NSString *videoPath;
    NSString *videoFileName;
    
    UIImage *thumbnailImage;
    BOOL isNewImagePixelBuffer;
    CVPixelBufferRef imagePixelBuffer;
}

@property (nonatomic, assign) id ParentID;
@property (nonatomic, retain)NSString *directoryPath;
@property (nonatomic,retain) NSString *videoPath;
@property (nonatomic,retain) NSString *videoFileName;

@property (nonatomic,retain) UIImage *thumbnailImage;

//passing a view that it needs to be captured
-(void)readyGo:(UIView *)aView;

-(void)stopRecord;

@property (nonatomic, assign) BOOL startRecordFlag;

-(void)startRecord__:(NSString *)fileName  VideoWidth:(NSInteger)width VideoHeight:(NSInteger)height;

-(void)startRecordJPEG__:(NSString *)fileName didReceiveRawDataFrame:(const char *)imgData DataSize:(NSInteger)size;

-(void)startRecordH264Image__:(NSString *)fileName VideoWidth:(NSInteger)width VideoHeight:(NSInteger)height;

-(void)startRecordH264__:(NSString *)fileName didReceiveRawDataFrame:(const char *)imgData VideoWidth:(NSInteger)width VideoHeight:(NSInteger)height;

- (void)setJPEGImgFrame:(const char *)imgData DataSize:(NSInteger)size;

- (void)setImgFrame:(const char *)imgData VideoWidth:(NSInteger)width VideoHeight:(NSInteger)height;

- (void)setImgFrame0:(const char *)imgData VideoWidth:(NSInteger)width VideoHeight:(NSInteger)height;

- (void)setImgFrame1:(UIImage *)img VideoWidth:(NSInteger)width VideoHeight:(NSInteger)height;

- (void)setImgFrame2:(const char *)imgData VideoWidth:(NSInteger)width VideoHeight:(NSInteger)height;

- (void)setImagePixelBufferFrame:(CVPixelBufferRef)buffer VideoWidth:(NSInteger)width VideoHeight:(NSInteger)height;


- (void)setUIImageFrame:(UIImage *)img VideoWidth:(NSInteger)width VideoHeight:(NSInteger)height;

- (UIImage *) displayImage:(CVImageBufferRef)imageBuffer;

@end

